'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const UserGroup = app.model.define('user_group', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    name: {
      type: STRING(100),
      allowNull: false,
      comment: '分组名称'
    },
    description: {
      type: STRING(500),
      allowNull: true,
      comment: '分组描述'
    },
    createdAt: {
      type: DATE,
      field: 'created_at'
    },
    updatedAt: {
      type: DATE,
      field: 'updated_at'
    }
  }, {
    tableName: 'user_groups',
    timestamps: true
  });

  return UserGroup;
};